package org.aeon.gamechatnest.exception;

import lombok.Getter;
import org.aeon.gamechatnest.common.response.RespStatus;

/**
 * @author: MissingAeon
 * @date: 2024/5/8 18:33
 * @description: 应用错误基类，所有自定义应用错误应继承此类
 */
@Getter
public class ApplicationException extends RuntimeException {

    private final Integer code;

    public ApplicationException(String message, Integer code) {
        super(message);
        this.code = code;
    }

    public ApplicationException(RespStatus respStatus) {
        this(respStatus.getMessage(), respStatus.getCode());
    }

    public ApplicationException(RespStatus respStatus, String message) {
        this(message, respStatus.getCode());
    }

    public ApplicationException(String message) {
        this(message, 300);
    }

    public ApplicationException() {
        this("错误", 300);
    }
}
